script_enemy_main{

let angle=rand(0,360);

let color=GetArgument;
color=(color-1)*40;
let grow=0;

let usespell=0;
let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

let SEdeath=("script\SoundEffects\enemydeath1.wav");
let SEshots5=("script\SoundEffects\shots5.wav");

let GRfamiliar=("\script\Images\OtherEffects\Chips.png");

@Initialize{
	LoadGraphic("\script\Images\OtherEffects\Chips.png");

	LoadSE("script\SoundEffects\enemydeath1.wav");
	LoadSE("script\SoundEffects\shots5.wav");

	SetScore(100);
	SetLife(20);
	SetDamageRate(10,10);
	MagicCircle(false);
}
	
@MainLoop{

SetCollisionA(GetX,GetY,grow*18);
SetCollisionB(GetX,GetY,grow*18);

if(GetX<=minx-32 || GetX>=maxx+32 || GetY<=miny-32 || GetY>=maxy+32 && time>=60){ VanishEnemy; }

let color=0;
if(GetArgument==1){ color=49; }
if(GetArgument==2){ color=50; }
if(GetArgument==3){ color=51; }
if(GetArgument==4){ color=53; }
if(GetArgument==5){ color=56; }
if(GetArgument==6){ color=57; }



if(GetCommonData("Difficulty")==1){

if(time%5==0){
	let shot1=0;
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle+90*cos(angle),0,0.006,0.8,color);
	FireShot(shot1);
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle-90*cos(angle),0,0.006,0.8,color);
	FireShot(shot1);
angle+=13;
}
if(time%5==0){ PlaySE(SEshots5); }

} //Easy


if(GetCommonData("Difficulty")==2){

if(time%4==0){
	let shot1=0;
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle+90*cos(angle),0,0.006,0.9,color);
	FireShot(shot1);
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle-90*cos(angle),0,0.006,0.9,color);
	FireShot(shot1);
angle+=13;
}
if(time%5==0){ PlaySE(SEshots5); }

} //Normal


if(GetCommonData("Difficulty")==3){

if(time%4==0){
	let shot1=0;
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle+105*cos(angle),0,0.007,1,color);
	FireShot(shot1);
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle-105*cos(angle),0,0.007,1,color);
	FireShot(shot1);
angle+=13;
}
if(time%5==0){ PlaySE(SEshots5); }

} //Hard


if(GetCommonData("Difficulty")==4){

if(time%4==0){
	let shot1=0;
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle+120*cos(angle),0,0.008,1.1,color);
	FireShot(shot1);
	CreateShotA(shot1,GetX,GetY,10);
	SetShotDataA(shot1,0,0,GetAngle-120*cos(angle),0,0.008,1.1,color);
	FireShot(shot1);
angle+=13;
}
if(time%5==0){ PlaySE(SEshots5); }

} //Lunatic



if(grow<1){ grow+=0.1; }

time++;
frame++;

}

@DrawLoop{
	SetGraphicScale(grow,grow);
	SetTexture(GRfamiliar);
	SetGraphicAngle(0,0,time*5);
	SetColor(255,255,255);
	SetRenderState(ALPHA);
	SetGraphicRect(0+color,0,40+color,40);
	DrawGraphic(GetX,GetY);
}

@Finalize{
if(BeVanished==false){ PlaySE(SEdeath); }
}

}